Component({
    /**
     * 组件的属性列表
     */
    properties: {
        firstSize: {
            type: Number,
            value: 28
        },
        secondSize: {
            type: Number,
            value: 28
        },
        color: {
            type: String
        },
        weight: {
            type: [String, Number],
            value: 400
        },
        price: {
            type: [String, Number],
            value: ""
        },
        showSubscript: {
            type: Boolean,
            value: true
        },
        subscriptSize: {
            type: Number,
            value: 28
        },
        lineThrough: {
            type: Boolean,
            value: false
        },
        symbol: {
            type: String,
            value: '￥'
        }
    },

    /**
     * 组件的初始数据
     */
    data: {
        priceSlice: {}
    },

    observers: {
        'price': function (p) {
            this.priceFormat()
        }
    },

    /**
     * 组件的方法列表
     */
    methods: {
        priceFormat() {
            let { price } = this.data;
            let priceSlice = {}
            if (price !== null) {
                price = parseFloat(price);
                price = String(price).split('.');
                priceSlice.first = price[0];
                priceSlice.second = price[1];
                this.setData({ priceSlice })
            }
        }
    }
})
